const http = require("http");

const server = http.createServer((request, response) => {
  const { method, url, headers } = request;
  // 设置状态码
  response.statusCode = 200;
  // 设置响应头
  response.setHeader("Content-Type", "text/plain");
  // 发送响应数据
  response.end("这是服务器的响应数据，hello world");
});

server.listen(3000, () => {
  console.log("server address: http://localhost:3000");
});


